# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(myNpmLib)

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

set(CMAKE_CXX_STANDARD 17)

file(GLOB_RECURSE PROTO_LITE_SRCS
    CONFIGURE_DEPENDS
    "${CMAKE_CURRENT_SOURCE_DIR}/pb_lite/*.pb.cc")
file(GLOB_RECURSE PROTO_STUB_SRCS
    CONFIGURE_DEPENDS
    "${CMAKE_CURRENT_SOURCE_DIR}/pb_lite/*.napi.cc")
file(GLOB PROTO_UTILS_SRCS
    CONFIGURE_DEPENDS
    "${CMAKE_CURRENT_SOURCE_DIR}/pb_lite/*.cpp")
list(APPEND PROTO_LITE_SRCS ${PROTO_STUB_SRCS} ${PROTO_UTILS_SRCS})

file(GLOB PROTO_LITE_HDRS
    CONFIGURE_DEPENDS
    "${CMAKE_CURRENT_SOURCE_DIR}/pb_lite/*.h")

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ${CMAKE_CURRENT_SOURCE_DIR}/../../../../third_party/libprotobuf-lite/include
                    ${CMAKE_CURRENT_SOURCE_DIR}/pb_lite)

file(REAL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/arm64-v8a MODULE_LIBS_DIR)

link_directories(MODULE_LIBS_DIR)

add_library(pbcpp SHARED ${PROTO_LITE_SRCS} napi_init.cpp)
target_link_libraries(pbcpp PUBLIC libace_napi.z.so libhilog_ndk.z.so)
target_link_libraries(pbcpp PRIVATE
    ${MODULE_LIBS_DIR}/libprotobuf.so.30.2.0
    ${MODULE_LIBS_DIR}/libutf8_validity.so.30.2.0
    ${MODULE_LIBS_DIR}/libabseil_dll.so.2501.0.0
#    protobuf-lite
#    absl_die_if_null
#    absl_log_initialize
#    absl_statusor
#    utf8_validity
#    absl_log_internal_check_op
#    absl_log_internal_conditions
#    absl_log_internal_message
#    absl_log_internal_nullguard
#    absl_examine_stack
#    absl_log_internal_format
#    absl_log_internal_structured_proto
#    absl_log_internal_proto
#    absl_log_internal_log_sink_set
#    absl_log_sink
#    absl_log_entry
#    absl_flags_internal
#    absl_flags_marshalling
#    absl_flags_reflection
#    absl_flags_config
#    absl_flags_program_name
#    absl_flags_private_handle_accessor
#    absl_flags_commandlineflag
#    absl_flags_commandlineflag_internal
#    absl_log_globals
#    absl_vlog_config_internal
#    absl_log_internal_fnmatch
#    absl_log_internal_globals
#    absl_raw_hash_set
#    absl_hash
#    absl_city
#    absl_low_level_hash
#    absl_hashtablez_sampler
#    absl_random_distributions
#    absl_random_seed_sequences
#    absl_random_internal_pool_urbg
#    absl_random_internal_randen
#    absl_random_internal_randen_hwaes
#    absl_random_internal_randen_hwaes_impl
#    absl_random_internal_randen_slow
#    absl_random_internal_platform
#    absl_random_internal_seed_material
#    absl_random_seed_gen_exception
#    absl_status
#    absl_cord
#    absl_cordz_info
#    absl_cord_internal
#    absl_cordz_functions
#    absl_exponential_biased
#    absl_cordz_handle
#    absl_synchronization
#    absl_graphcycles_internal
#    absl_kernel_timeout_internal
#    absl_time
#    absl_civil_time
#    absl_time_zone
#    absl_tracing_internal
#    absl_crc_cord_state
#    absl_crc32c
#    absl_crc_internal
#    absl_crc_cpu_detect
#    absl_bad_optional_access
#    absl_stacktrace
#    absl_leak_check
#    absl_strerror
#    absl_symbolize
#    absl_debugging_internal
#    absl_malloc_internal
#    absl_demangle_internal
#    absl_demangle_rust
#    absl_decode_rust_punycode
#    absl_utf8_for_code_point
#    absl_bad_variant_access
#    absl_str_format_internal
#    absl_strings
#    absl_int128
#    absl_strings_internal
#    absl_string_view
#    absl_base
#    absl_spinlock_wait
#    absl_throw_delegate
#    absl_raw_logging_internal
#    absl_log_severity
    )
